// 导航
document.querySelector('#btn-span').onclick = function () {
    if (document.querySelector('.more-ul').style.display == 'none') {
        document.querySelector('.more-ul').style.display = 'block';
        document.querySelector('.more-ul').style.zindex = '5';
    } else {
        document.querySelector('.more-ul').style.display = 'none';
    }
}

//获取导航 小导航
var header = document.querySelector('.header');
var neck = document.querySelector('.neck');
// 滚动事件
$(window).scroll(function () {
    if (ScollPostion().top > 0) {
        header.style.display = 'none';
        neck.style.top = 0 + 'px';
    } else if (ScollPostion().top == 0) {
        header.style.display = 'inline-block';
        neck.style.top = 48 + 'px';
    }
});
function ScollPostion() { //滚动条位置
    var t, l, w, h;
    if (document.documentElement && document.documentElement.scrollTop) {
        t = document.documentElement.scrollTop;
        l = document.documentElement.scrollLeft;
        w = document.documentElement.scrollWidth;
        h = document.documentElement.scrollHeight;
    } else if (document.body) {
        t = document.body.scrollTop;
        l = document.body.scrollLeft;
        w = document.body.scrollWidth;
        h = document.body.scrollHeight;
    }
    return {
        top: t,
        left: l,
        width: w,
        height: h
    };
}

var arr = document.querySelectorAll('.act-hd-piece');
for (var i = 0; i < arr.length; i++) {
    arr[i].onmouseover = function () {
        // console.log(1);
        this.style.marginTop = -5 + 'px';
        this.style.boxShadow = '1px 1px 10px 2px rgb(187, 186, 186)'
    }
    arr[i].onmouseout = function () {
        // console.log(1);
        this.style.marginTop = 0 + 'px';
        this.style.boxShadow = 'none'
    }
}




let showArr = function () {
    $.ajax({
        type: 'get',
        url: '/activeFind',
        data: '',
        success: function (data) {
            let actStr = template('active_template', { list: data });
            $('.act-hd').html(actStr);
        }
    })
}
showArr();


$('.iconfont').on('click', function () {
    location.href = "/hezuo"
})
